<?php
if ( $is_print ) {
	header('Content-type: application/vnd.ms-excel');
	header('Content-Disposition: attachment; filename=Order List ' .strtotime('now').'.xls');
}
?>

<table border=1>
	<tr><th>{{ implode('</th><th>', $headers) }}</th></tr>
	@foreach ( $items as $value )
		<tr>
			<td>{{ $value['ORDER_id'] }}</td>
			<td>{{ $statuses[$value['order_status']] }}</td>
			<td>{{ $value['id'] }}</td>
			<td>{{ $statuses[$value['item_status']] }}</td>
			<td>{{ $value['employee_number'] }}</td>
			<td>{{ $value['firstname'] }}</td>
			<td>{{ $value['lastname'] }}</td>
			<td>{{ $value['email'] }}</td>
			<td>{{ $value['mobile'] }}</td>
			<td>{{ $value['company_code'] }}</td>
			<td>{{ $value['branch_code'] }}</td>
			<td>{{ $value['name'] }}</td>
			<td>{{ $value['model'] }}</td>
			<td>{{ $value['category'] }}</td>
			<td>{{ $value['size'] }}</td>
			<td>{{ number_format($value['benstore_price'], 2) }}</td>
			<td>{{ $value['quantity'] }}</td>
			<td>{{ $value['option_value'] }}</td>
			<td>{{ $value['option_quantity'] }}</td>
			<td>{{ number_format($value['option_price'], 2) }}</td>
			<td>{{ $value['delivery_method'] }}</td>
			<td>{{ $value['unit'] }}</td>
			<td>{{ $value['street'] }}</td>
			<td>{{ $value['barangay'] }}</td>
			<td>{{ $value['city'] }}</td>
			<td>{{ $value['zip_code'] }}</td>
			<td>{{ $value['address'] }}</td>
			<td>{{ number_format($value['delivery_fee_peso'], 2) }}</td>
			<td>{{ number_format($value['delivery_fee_points'], 2) }}</td>
			<td>{{ number_format($value['peso'], 2) }}</td>
			<td>{{ number_format($value['tax'], 2) }}</td>
			<td>{{ number_format($value['points'], 2) }}</td>
			<td>{{ number_format($value['topup'], 2) }}</td>
			<td>{{ number_format($value['delivery_fee'], 2) }}</td>
			<td>{{ number_format($value['order_peso'], 2) }}</td>
			<td>{{ number_format($value['order_tax'], 2) }}</td>
			<td>{{ number_format($value['order_points'], 2) }}</td>
			<td>{{ number_format($value['order_topup'], 2) }}</td>
			 <td>{{ $value['date_ordered'] }}</td>
			 <td>
			 	@if ( !empty($value['po_date']) )
			 		{{ Formatter::toDateFormat( $value['po_date'], 'm/d-Y' ) }}
			 	@endif	
			 </td>
			 <td></td>
			 <td></td>
			 <td>{{ $value['comment'] }}</td>
		</tr>
	@endforeach
</table>